<!doctype html>
<html>
<head>
	<meta charset="UTF-8">
	<title></title>
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<link href="../css/mui.min.css" rel="stylesheet" />
	<link rel="stylesheet" type="text/css" href="../css/orderStatus.css"/>
</head>
<body class="gray">
	<div class="mui-content loading" id="vueMain">
  		<div class="item comment">
  			<div class="product" >
  				<ul class="mui-table-view">
  				    <li class="mui-table-view-cell mui-media">
  				        <a href="javascript:;">
  				            <img class="mui-media-object mui-pull-left" :src="list.img" />
  				            <div class="mui-media-body consf">
  				                {{list.name}}
  				                <p>所属类型：{{list.commend_name}}</p>
  				                <!--<p>所属分类：{{list.category_name}}</p>-->
  				                <!--<p>服务城市：{{list.city_name}}</p>--> 
  				            </div>
  				        </a>
  				    </li>
  				</ul>
  			</div>
  		</div>
  		
  		<ul class="mui-table-view itemlist">
  			<li class="mui-table-view-cell" v-if="list.num">
	        		<div class="mui-pull-right mui-text-right">{{list.num.value}}</div>
	        		<div class="mui-pull-left">计划人数</div>
	        </li>
	        <li class="mui-table-view-cell">
	        		<div class="mui-pull-right mui-text-right">
	        			归还时间
	        			<p>{{list.endTime}}</p>
	        		</div>
	        		<div class="mui-pull-left">
	        			租赁日期
	        			<p>{{list.startTime}}</p>
	        		</div>
	        </li>
	        <li class="mui-table-view-cell">
	        		<div class="mui-pull-right mui-text-right">{{list.type.value}}</div>
	        		<div class="mui-pull-left">类型</div>
	        </li>
	        <li class="mui-table-view-cell">
	        		<div class="mui-pull-right mui-text-right">{{list.money.value}}</div>
	        		<div class="mui-pull-left">预算</div>
	        </li>
	    </ul>
	    
	    <div class="mui-content-padded" style="margin-top: 20px;" v-if="list.replay_money != '0.00'">
	   		<button type="button" class="bexta-btn bexta-btn-red mui-btn mui-btn-block tijiao" >查看</button>
	   </div>
  		<div class="mui-content-padded" style="margin-top: 20px;" v-else>
	   		<button type="button" class="bexta-btn bexta-btn-gray mui-btn mui-btn-block weikuaifu" >查看</button>
	   </div>
  		
	</div>
<script src="../js/mui.min.js"></script>
<script src="../js/vue.min.js"></script>
<script src="../js/bexta.js"></script>
<script type="text/javascript">
	var apps, views, user;
	mui.init({
		beforeback:function(){
			if( views.opener().id == 'server' ){
				bexta.setStatus(true);
			}
		}
	});
	mui.plusReady(function () {
	    views = bexta.getWebview();
	    user = bexta.getStorage(USER);
	    bexta.ajax(api.goods_consult_detail, function(res){
	    		initVue(res);
	    }, {data:{uid:user.uid, id:views.cid}});
	});
	function initVue(res){
		//数据处理一下
		var time = res.activity_time.split('至');
		res['startTime'] = time[0];
		res['endTime'] = time[1];
		var type = res.activity_type[0].split('*');
		res['type'] = {
			name:type[0],
			value:type[1]
		};
		var money = res.activity_type[1].split('*');
		res['money'] = {
			name:money[0],
			value:money[1]
		};
		if( res.activity_type[2] ){
			var num = res.activity_type[2].split('*');
			res['num'] = {
				name:num[0],
				value:num[1]
			};
		}
		
		apps = new Vue({
			el:'#vueMain',
			data:{
				list:res
			},
			mounted:function(){
				document.querySelector('.loading').classList.add('loadRun');
				var self = this;
				mui('.mui-content').on('tap', '.weikuaifu', function(){
			 		mui.toast("商家还没回复");
				});
			 	mui('.mui-content').on('tap', '.tijiao', function(){
			 		mui.confirm("<p>商家出价</p>订金:"+self.list.pay_fee + "<br />总额:"+self.list.replay_money , TITLE, ["取消", "生成订单"], function(item){
			 			if( item.index == 1 ){
			 				bexta.ajax(api.buy_now, function(res){
			 					bexta.openWithTitle({
			 						id:"confirmOrder",
			 						url:"confirmOrder.html",
			 						extras:{
			 							order_no:res.order_no
			 						}
			 					},{
			 						title:{
			 							text:"订单确认"
			 						}
			 					})
			 				}, {data:{uid:user.uid, goods_id:self.list.goods_id, product_id:self.list.product_id, consult_id:self.list.id}});
			 			}
			 		}, 'div');
			 	});
			}
		});
	}
</script>
</body>
</html>